Skip to content

Experiment with a command-line tool for querying profile contents#5663

Draft
mstange wants to merge 57 commits intofirefox-devtools:mainfrom
mstange:pq-cli-wip
Draft

Experiment with a command-line tool for querying profile contents#5663
mstange wants to merge 57 commits intofirefox-devtools:mainfrom
mstange:pq-cli-wip

Conversation

@mstange
Copy link
Copy Markdown
Contributor

@mstange mstange commented Nov 6, 2025

Sometimes I've wanted to inspect profiles from the command line, without loading them in the web UI.

Here's an experiment I've been working on, which creates a pq tool ("profile query"). To test, clone this branch and run yarn build-profile-query-cli - this creates a ./dist/pq.js artifact. Then somehow make it accessible via your path, for example by putting a shell script with the contents node ~/code/profiler/src/profile-query-cli/dist/pq.js "$@" into a bin directory in your path.

Or you can run yarn link in ./profile-query-cli/ to link pq globally.

pq load 'https://share.firefox.dev/hash' or pq load profile.json.gz start a session.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 57.73875% with 1155 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.72%. Comparing base (4308a73) to head (acd5f98).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/profile-query/index.ts 49.34% 272 Missing ⚠️
src/profile-query/formatters/marker-info.ts 70.21% 220 Missing and 1 partial ⚠️
src/profile-query/formatters/page-load.ts 0.46% 215 Missing ⚠️
src/profile-query/filter-stack.ts 3.40% 85 Missing ⚠️
src/profile-query/formatters/thread-info.ts 50.31% 80 Missing ⚠️
src/profile-query/formatters/profile-info.ts 0.00% 58 Missing ⚠️
src/profile-logic/transforms.ts 65.21% 56 Missing ⚠️
src/profile-query/loader.ts 0.00% 47 Missing ⚠️
src/profile-query/cpu-activity.ts 47.88% 37 Missing ⚠️
src/profile-query/thread-map.ts 32.14% 19 Missing ⚠️
... and 10 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5663      +/-   ##
==========================================
- Coverage   85.37%   83.72%   -1.65%     
==========================================
  Files         322      331       +9     
  Lines       32069    34680    +2611     
  Branches     8814     9561     +747     
==========================================
+ Hits        27378    29036    +1658     
- Misses       4260     5215     +955     
+ Partials      431      429       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@canova canova force-pushed the pq-cli-wip branch 5 times, most recently from 288f7da to c87bd3c Compare March 16, 2026 21:44
@canova canova force-pushed the pq-cli-wip branch 13 times, most recently from c564e9b to 6b4c906 Compare April 16, 2026 10:42
canova and others added 7 commits April 16, 2026 13:54
This is useful for cases where I want to drop all the "idle" category
samples, so I can focus on non-idle samples. Or it can be useful for
dropping the whole profiler overhead by removing the "profiler"
category.

I would like to use this transform in the pq cli tool, so we can remove
the idle category before finding the "top functions". Otherwise the idle
category just pollutes the output of the cli a lot.
A `yarn test:cli` script was added to run only the cli tests, but it
looks like the main tests are also running them since they match the
testMatch glob.
canova added 26 commits April 16, 2026 13:54
This gives much better defaults for a cli, and has much better
ergonomics. For example, we didn't have per-command help, and commander
handles it out of the box. Also we don't have to parse all the cli
arguments one by one, commander takes care of them for us. Overall it
makes adding a new command and updating them easier.
I've tried to use and love the profiler-cli in the terminal, but it's
just so difficult to type compared to pq, and it made me so annoyed. I
think it makes sense to publish the package as profiler-cli, but this pq
symlink as a shortcut is such a huge productivity boost if you are
actually using the tool yourself.
Denis' tool has this feature already. It's good if we support it too
since the logs are important for some teams.
This is very similar to Denis' tool's --page-load
@canova canova added the cli Issues related to the profiler CLI label Apr 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli Issues related to the profiler CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants